<template>
	<view class="bottomTabBar aic jca">
		<view class="bottomTabBar-item "
		:class="currentIndex==index?'active-bottomTabBar-item':''"
		v-for="(item,index) in tabList"
		:key="index"
		@tap="getIndex(index)"
		>
		
			<view class="img" v-if="item.icon!=''">
				<image :src="item.icon" mode=""></image>
			</view>
			<view class="title" v-if="item.name!=''">
				{{item.name}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"bottomTabBar",
		props:{
			currentIndex:{
				type:Number,
				default:0,
			}
		},
		data() {
			return {
				tabList:[
					{
						name:"首页",
						icon:"/static/tabbar/595d485167531c95fb55ee24fd88770.png"
					},
					{
						name:"任务",
						icon:"/static/tabbar/2dc12e7b782fd771bee3da7c6191e61.png"
					},
					{
						name:"消息",
						icon:"/static/tabbar/23427f82dcf0773b77df5ec2931d36e.png"
					},
					{
						name:"我的",
						icon:"/static/tabbar/04dc306d616acd1c22d5c11a685e50b.png"
					}
				]
			};
		},
		methods:{
			getIndex(index){
				this.$emit('change',{
					index:index,
					item:this.tabList[index]
				})
			}
		}
	}
</script>

<style lang="scss">
.bottomTabBar{
	width: 750rpx;
	height: 120rpx;
	background-color: #fff;
	border-top: 1px solid #C8C9CC;
	font-size: 25rpx;font-weight: bold;
	.bottomTabBar-item{
		color: #000;
		flex: 1;
		.img{
			width: 45rpx;
			height: 45rpx;
			margin: 0 auto;
			image{
				width: 45rpx;
				height: 45rpx;
			}
		}
		.title{
			text-align: center;
		}
	}
	.active-bottomTabBar-item{
		position: relative;
		color: $llt-type-primary;
		
	}
	// after
	.active-bottomTabBar-item:after{
		position: absolute;
		content: " ";
		width: 60rpx;
		bottom: -10rpx;
		left: 50%;
		transform: translateX(-50%);
		height: 9rpx;
		border-radius: 300%;
		background-color: $llt-type-primary;
	}
	
}
</style>
